package datastream.api.operator.multi;

import datastream.api.operator.multi.pojo.user.InputModel;
import datastream.api.operator.multi.source.user.UserSource1;
import datastream.api.operator.multi.source.user.UserSource2;
import datastream.api.operator.multi.source.user.UserSource3;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.datastream.DataStreamSink;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class Union {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(2);

        DataStreamSource<InputModel> source1 = env.addSource(new UserSource1());
        DataStreamSource<InputModel> source2 = env.addSource(new UserSource2());
        DataStreamSource<InputModel> source3 = env.addSource(new UserSource3());

        DataStream<InputModel> union = source1.union(source2, source3);

        DataStreamSink<InputModel> sink = union.print();

        env.execute();
    }
}
